Learn R Programming

DNAprofiles (version 0.3.1)

profiles extract: profiles extract

Description

Profiles are stored in a profiles object, which is merely an integer matrix together with allelic frequencies stored as an attribute "freqs".

Usage

"["(x,i,j,...)

Arguments

x
profiles object
i
vector or matrix
j
(optionally) vector
...
passed on to [.matrix

Examples

Run this code
data(freqsNLsgmplus)
x <- sample.profiles(N=10,freqsNLsgmplus)
y <- unclass(x);attr(y,"freqs") <- NULL

stopifnot(identical(as.vector(x[1,]),as.vector(y[1,])))
stopifnot(identical(as.vector(x[1:10]),as.vector(y[1:10])))
stopifnot(identical(as.vector(x[5,5]),as.vector(y[5,5])))
stopifnot(identical(as.vector(x[,1:10]),as.vector(y[,1:10])))
stopifnot(identical(as.vector(x[,]),as.vector(y[,])))
stopifnot(identical(as.vector(x[cbind(2,1:10)]),as.vector(y[cbind(2,1:10)])))

Run the code above in your browser using DataLab